package com.guomao.filedemos;

import java.io.File;
import java.io.IOException;

public class FileDemoI {


    public static void main(String[] args) throws IOException {

        String filepath = "my_directory";

        File my_directory = new File(filepath);

        if (!my_directory.exists()) {
            my_directory.mkdirs();
        }


        File file1 = new File(my_directory, "guomao2503");
        if (!file1.exists()) {
            file1.mkdirs();
        }
        File file2 = new File(my_directory, "FileDemo.java");

        if (!file2.exists()) {
            file2.createNewFile();
        }

//        File[] arr = my_directory.listFiles();
//
//        for (File file : arr) {
//            System.out.println(file.getAbsolutePath());
//        }


//        flag代表当前file对象删除成功还是失败
        boolean flag = file1.delete();

        if (file1.delete() && file2.delete()) {
            my_directory.delete();
        }

//        System.out.println(my_directory.delete());


    }
}
